$(function () {
    // $('.category').children('li').click(function () {
    //     $(this).addClass('current').siblings().removeClass('current');
    //     $(this).children('a').css('color', '#fff');
    //     $(this).siblings().children('a').css('color', '#000');
    // });



    let nowUrl = window.location.href;
    console.log(nowUrl);
    let params = UrlParamHash(nowUrl);
    let brand = params['f1'];
    let price1 = params['price1'];
    let price2 = params['price2'];
    let rank = params['r1'];
    let energy = params['n1'];

    let price;
    if (price1 == 0 && price2 == 100000){
        price = '10万以下';
    }else if (price1 == 100000 && price2 == 150000){
        price = '10万-15万';
    }else if (price1 == 150000 && price2 == 200000){
        price = '15万-20万';
    }else if (price1 == 200000 && price2 == 250000){
        price = '20万-25万';
    }else if (price1 == 250000 && price2 == 300000){
        price = '25万-30万';
    }else if (price1 == 300000 && price2 == 400000){
        price = '30万-40万';
    }else if (price1 == 400000 && price2 == 500000){
        price = '40万-50万';
    }else if (price1 == 500000 && price2 == 0){
        price = '50万以上';
    }
    // console.log(brand,price,rank,energy);

    //获取URL价格并改变页面内样式
    let arr = [];
    $('ul.carPrice li').children('a').each(function (){
        arr.push($(this).text())
    });

    for (let i = 0;i<arr.length;i++){
        if (arr[i] == price){
            i++;
            $('.carPrice').find('li:eq('+i+')').addClass('current').siblings().removeClass('current');
        }
    }

//     获取URL品牌并改变页面内样式
    let arr1 = [];
    brand = decodeURI(brand);
    $('.brand li').children('a').children('span').each(function (){
        arr1.push($(this).text())
    });

    for (let i = 0;i<arr1.length;i++){
        if (arr1[i] == brand){

            i = i + 2;
            $('.brand').find('li:eq('+i+')').addClass('current').siblings().removeClass('current');
        }
    }

    //     获取 URL级别 并改变页面内样式
    let arr2 = [];
    rank = decodeURI(rank);
    $('.rank li').children('a').children('span').each(function (){
        arr2.push($(this).text())
    });

    for (let i = 0;i<arr2.length;i++){
        if (arr2[i] == rank){
            i = i + 2;
            $('.rank').find('li:eq('+i+')').addClass('current').siblings().removeClass('current');
        }
    }

    //获取 URL价格 并改变页面内样式
    let arr3 = [];
    energy = decodeURI(energy);
    $('ul.energy li').children('a').each(function (){
        arr3.push($(this).text())
    });
    for (let i = 0;i<arr3.length;i++){
        if (arr3[i] == energy){
            i++;
            $('.energy').find('li:eq('+i+')').addClass('current').siblings().removeClass('current');
        }
    }
});
